<template>
	<view>
		<view class="search_box">
			<image src="../../static/s1.png" class="goback" @click="gobackClick" mode="widthFix"></image>
			<text class="topicText">我要捐赠</text>
		</view>
		<view class="worship">
			<view class="worship_text" v-show="worShow">
				<text>观世音菩萨</text>
				<view class="textNum" style="margin-top: 10rpx;">
					已有捐赠：
					<text class="amount">5646133</text>
				</view>
			</view>
			<image src="../../static/guanyin.png" style="width: 374rpx;margin-top: 20%;" mode="widthFix"></image>
			<view class="money" v-show="worShow">
				<text>金额：</text>
				<input type="text" value="" class="moneyInp" v-model="moneyText" />
			</view>
			<!-- 捐赠按钮 -->
			<view class="worBtn" @click="boxClick()">捐赠</view>
			<!-- 捐赠成功的图 -->
			<image src="../../static/box.png" class="boxImg" mode="widthFix" v-if="flag"></image>
			<text class="boxText" v-if="show">您已成功捐赠</text>
		</view>
		<view class="footer">
			<text v-for="(item,index) in itemList" :key="index" :class="{ 'active':current===index }" @click="textClick(index)">{{item.title}}</text>
		</view>
		<!-- 祈愿按钮 -->
		<view class="worBtn" v-show="showWor" @click="wishClick">去祈愿</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				flag: false,
				moneyText: '', //捐赠的金额
				show: false,
				itemList: [{
						index: 0,
						title: '主页'
					},
					{
						index: 1,
						title: '简介'
					},
					{
						index: 2,
						title: '拜佛'
					},
					{
						index: 3,
						title: '祈愿'
					},
					{
						index: 4,
						title: '捐赠'
					}
				],
				current: 4,
				showWor:false,
				worShow:true
			}
		},
		mounted() {
			//功德箱
			this.timer = setInterval(() => {
				this.flag = false
			}, 10000)
		},
		methods: {
			//捐赠成功的
			boxClick() {
				this.flag = true
				this.moneyText = ''
			},
			gobackClick() {
				uni.navigateTo({
					url: 'Bodhisattva'
				})
			},
			textClick(index) {
				this.current = index
				if (index == 0) {
					uni.navigateTo({
						url: './Bodhisattva'
					})
				} else if (index == 1) {
					this.$refs.popup.open()
				} else if (index == 2) {
					uni.navigateTo({
						url: './Wish'
					})
				} else if (index == 3) {
					this.showWor=true
					this.worShow=false
				} else if (index == 4) {
					uni.navigateTo({
						url: './Worship'
					})
				}
			
			},
			//去祈愿
			wishClick(){
				uni.navigateTo({
					url:'./Donate'
				})
			}
		}
	}
</script>

<style lang="scss">
	.worship {
		display: flex;
		//justify-content: center;
		align-items: center;
		flex-direction: column;
		width: 100%;
		height: 100vh;
		background: url(../../static/bgcPray.png) no-repeat;
		background-size: 100% 100%;
		padding: 20rpx 20rpx;
		box-sizing: border-box;

		.worship_text {
			display: flex;
			flex-direction: column;
			justify-content: flex-end;
			font-size: 31rpx;
			color: #9F383C;
			text-align: right;
			position: absolute;
			right: 20rpx;
			top: 180rpx;

			.amount {
				background-color: #C52B2E;
				color: #fff;
				padding: 0 10rpx;
				border-radius: 8rpx;
			}
		}

		.money {
			display: flex;
			align-items: center;
			justify-content: center;
			margin: 20rpx 0;
			width: 100%;
			//background-color: pink;
			padding: 10rpx 0;
			font-size: 28rpx;
			color: #333;
			font-weight: 800;

			.moneyInp {
				width: 127rpx;
				height: 69rpx;
				border: 3rpx solid #CECECE;
				background-color: #fff;
				border-radius: 10rpx;
				//padding-left: 10rpx;
				box-sizing: border-box;
				text-align: center;
				font-weight: 400;
			}
		}

		.worBtn {
			display: flex;
			align-items: center;
			justify-content: center;
			color: #fff;
			font-size: 28rpx;
			letter-spacing: 2rpx;
			margin-top: 20rpx;
			width: 211rpx;
			height: 69rpx;
			background-color: #C52B2E;
			border-radius: 35rpx;
		}

		.boxImg {
			position: absolute;
			bottom: 130rpx;
			width: 315rpx;
		}

		.boxText {
			position: absolute;
			bottom: 130rpx;
			width: 288rpx;
			height: 89rpx;
			background-color: #fff;
			border-radius: 40rpx;
			font-size: 28rpx;
			color: #333;
			text-align: center;
			line-height: 89rpx;
			letter-spacing: 2rpx;
		}
	}
	.footer {
		position: fixed;
		bottom: 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 30rpx;
		box-sizing: border-box;
		width: 100%;
		height: 100rpx;
		background-color: #C52B2E;
		font-size: 30rpx;
		color: #FFFFFF;
		letter-spacing: 2rpx;
	
		.active {
			color: #FFD500;
		}
	}
	
</style>
